<!DOCTYPE html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/common/common.jsp"%>
<%--<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>--%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta charset="utf-8" />
		<title>厅干部平时考核管理系统</title>
		<%--<link rel="stylesheet" type="text/css" href="<c:url value='/resource/jxkh/css/main.css'/>" />
		<link rel="stylesheet"  href="<c:url value='/resource/jxkh/css/zTreeStyle/zTreeStyle.css'/>" type="text/css" />
		<script type="text/javascript" src="<c:url value='/resource/jxkh/js/jquery-1.11.0.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/jxkh/js/layer/layer.js'/>" ></script>
		<script type="text/javascript" src="<c:url value='/resource/jxkh/js/jquery.ztree.core.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/jxkh/js/jquery.ztree.excheck.js'/>"></script>
		<script type="text/javascript" src="<c:url value='/resource/jxkh/js/jquery.ztree.exedit.js'/>"></script>--%>
		<style type="text/css">
			#jedatebox{z-index: 9999999999999999999999999999!important;}
		</style>
		<script type="text/javascript">
			var win;
			$(function() {
				initTable();//初始化表格
				//初始化布局
				$.fn.zTree.init($("#treeDemo"), setting);
				initView();
				/*$("#ifrm_deptlist").attr("src","<c:url value='/user/list/${_SESSION_LOGIN_USER.deptId}/1.html'/>");*/
			});
			//界面初始化
			function initView(){
				$("#right,#tree_wrap_div").css({"height":$(window).height()});
				$("#ifrm_deptlist").css({"height":$(window).height()-4});
			}
			var setting = {
				async : {
					enable : true,
					url : "/jxkh/dept/dragtree.json",
					dataType : "json",
					type : 'get',
					autoParam : [ "deptId" ],
					dataFilter : function(treeId, parentNode, childNodes) {
						$.each(childNodes,function(i,node){
							node.drag = true;
						});
						return childNodes.data
					}
				},
				callback : {
					onClick : zTreeOnClick
				},
				data : {
					key:{
						name:"alias"
					},
					simpleData : {
						enable : true,
						idKey : "deptId",
						pIdKey : "parentId",
						rootPId : 0
					}
				},
				edit:{
					enable:true,
					showRemoveBtn:false,
					showRenameBtn:false
				}
			};
			function zTreeOnClick(event, treeId, treeNode) {
				var opt = {
					url :"/jxkh/personnel/findPersonnelInfoByDeptId.json?deptId="+treeNode.deptId,//部门人员列表
					silent: true,
					/*query:{
						deptId:treeNode.deptId
					}*/
				};
				$("#boot_table").bootstrapTable('refresh', opt);
			}
		</script>
	</head>


	<body>
	<div class="njga">
		<div class="bmkhcp"  style="background: #fff;overflow: hidden;">
			<div class="bmkhcp_row">
				<div class="bmkhcp_lf" style="width: 100%;">
					<div class="title">人员管理</div>
					<div class="rygl">
						<div class="rygl_lf" id="rygl_lf">
								<div id="tree_wrap_div" class="zTreeDemoBackground left" style="width:220px;margin:0px;padding:0px;overflow-x:hidden;float:left;overflow-y:auto;background-color:#f2f2f2;">
									<ul id="treeDemo" class="ztree" style="width:220px;overflow-x:hidden;height:440px"></ul>
								</div>
								<%--<div id="right" style="margin-left:221px !important;">
									<iframe id="ifrm_deptlist" name="ifrm_deptlist" style="width:100%;height:100%;border:none;" scrolling="no" frameborder="0"></iframe>
								</div>--%>
						</div>
						<div class="rygl_rt" id="rygl_rt">
							<div class="rygl_rt_main">
								<!--新增rt头部（人员调度）-->
								<%--<div class="rygl_rt_top">
									<div class="rydd" id="rygl_bmtz">
										<img src="<c:url value='/resource/jxkh/images/rydd_icon.png'/>" />人员调度
									</div>
									<div class="ul_bj">
										<div class="ul_bj_lf" id="rybj">编辑</div>
										<div class="ul_bj_lf ul_bj_rt">删除</div>
									</div>
									<button type="button" class="but">保存</button>
									<div class="inpt">
										<input type="text" placeholder="搜索部门人员" class="inpt_lf" />
										<div class="inpt_rt">
											<img src="<c:url value='/resource/jxkh/images/search.png'/>" />
										</div>
									</div>
								</div>--%>
								<table id="boot_table"></table>
								<!--新增rt头部（人员调度）结束-->
								<%--<table class="table_rygl ">
									<tr>
										<th width="5%">
											<input type="checkbox" id="chkAll" style="margin-left: 2px;" />
										</th>
										<th width="11%">姓名</th>
										<th width="12%">警号</th>
										<th width="12%">工作单位</th>
										<th width="14%">部门</th>
										<th width="15%">角色</th>
										<th width="12%">参与考核</th>
										<th width="12%">授权管理</th>
									</tr>
									<c:forEach var="i" items="${list}" begin ="0" end="8">
									<tr>
										<td>
											<input type="checkbox" name="chkGuid" value="${i.dbid}" />
										</td>
										<td>${i.name}</td>
										<td>${i.policeNum}</td>
										<td>${i.workUnit}</td>
										<td>${i.department}</td>
										<td>
											<div class="row_select row_select2">
												<p>其他人员</p>
												<div class="arrow_down"></div>
												<ul class="row_select_xl">
													<li>主要领导</li>
													<li>副处长</li>
													<li>其他人员</li>
												</ul>
											</div>
										</td>
										<td>
											<div class="inpt_w1 inpt_w2">
												<div class="inpt_w1_l inpt_w1_l_hov"></div>
												<div class="inpt_w1_r">是</div>
											</div>
										</td>
										<td>
											<div class="inpt_w1">
												<div class="inpt_w1_l"></div>
												<div class="inpt_w1_r">考官</div>
											</div>
										</td>
									</tr>
									</c:forEach>
								</table>
								<!--分页-->
								<div class="paging">
									<a href="#">首页</a>
									<a href="#" class="a_hov">1</a>
									<a href="#">2</a>
									<a href="#">3</a>
									<a href="#">4</a>
									<a href="#">5</a>
									<a href="#">6</a>
									<a href="#">尾页</a>
								</div>--%>
							</div>
						</div>
					</div>

				</div>
			</div>

		</div>
	</div>
	<!--新增周报弹出框-->
	<div class="date_pop date_pop1" id="date_pop">
		<div class="row_pop_row">
			<div class="row_pop_row_lf">
				<div class="row_pop_row_lf_top">
					<input type="text" placeholder="请输入查询关键字" class="inpt" />
				</div>
				<div class="row_pop_row_lf_b">
					<ul id="tree" class="filetree">
						<li><span class="folder">厅长办公室</span>
							<ul>
								<li><span class="folder">指挥中心</span>
									<ul>
										<li><span class="folder">情报室</span>
											<ul>
												<li><span class="folder">科室1</span>
													<span class="folder">科室2</span>
													<span class="folder">科室3</span>
													<span class="folder">科室4</span>
												</li>
											</ul>
										</li>
										<li><span class="folder">指挥调度室</span></li>
										<li><span class="folder">指挥调度室</span></li>
										<li><span class="folder">指挥调度室</span></li>
									</ul>
								</li>

							</ul>
						</li>
						<li><span class="folder">办公室</span>
							<ul>
								<li><span class="folder">部门管理</span></li>
								<li><span class="folder">部门管理</span></li>
							</ul>
						</li>
					</ul>
				</div>
			</div>
			<div class="row_pop_row_rt">
				<p>已选联系人：<span>3</span>/<span>100</span></p>
				<div class="name_wraper">
					<div class="name">张光勇
						<div class="del">
							<img src="<c:url value='/resource/jxkh/images/guanbi.png'/>" />
						</div>
					</div>
					<div class="name">甘苦
						<div class="del">
							<img src="<c:url value='/resource/jxkh/images/guanbi.png'/>" />
						</div>
					</div>
					<div class="name name_hov">金德隆
						<div class="del">
							<img src="<c:url value='/resource/jxkh/images/guanbi.png'/>" />
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--弹出框结束-->
	<script type="text/javascript">
		function getContentSize() {
			var h = document.documentElement.clientHeight; //clientHeight内容可视区域的高度
			ch = (h - 121) + "px";
			document.getElementById("rygl_lf").style.height = ch;
			document.getElementById("rygl_rt").style.height = ch;
		}
		window.onload = getContentSize; //页面加载时调用getContentSize()
		window.onresize = getContentSize; //当改变窗口大小时会出发getContentSize()
		$(document).ready(function() {
			$("#date_pop").hide();
			//部门调整弹出框
			$("#rygl_bmtz").on("click", function() {
				var open = layer.open({
					type: 1, //0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）。
					shift: 1, //动画    0-6     css3动画
					closeBtn: 1, //关闭按钮  0 不显示  style  1和2  标题为 false 2
					btn: ['确定', '取消'],
					title: ['资源', 'background:#5f9ad1;color:#fff;text-align: left;font-size: 18px;'],
					area: ['508px', '500px'], //宽高
					content: $("#date_pop") //iframe层-禁滚动条  $("#photosDemo").html()   'http://www.baidu.com/'
				});
			});
			//部门调整弹出框结束
			//角色授权管理选择
			$(".inpt_w1 .inpt_w1_l").click(function() {
				$(this).toggleClass("inpt_w1_l_hov");
			});
			//角色授权管理选择结束
			//下拉框
			$(document).click(function() {
				$(".row_select_xl").slideUp(200);
			});
			$(".row_select").click(function(e) {
				e = e || window.event;
				if(e.stopPropagation) {
					e.stopPropagation();
				} else {
					e.cancelBubble = true;
				}
				$(this).children(".row_select_xl").slideToggle(200);
				$(this).parents("tr").siblings("tr").find(".row_select_xl").hide();
				var selecttext = $(this).children("p");
				var selectmain = $(this).children(".row_select_xl");
				var lis = selectmain.find('li');
				for(var i = 0; i < lis.length; i++) {
					lis[i].onclick = function() {
						selectmain.hide();
						var textval = $(this).html();
						selecttext.text(decodeURIComponent(textval));
					}
				}
			});
			$(".row_select_xl li").click(function(e){
				e = e || window.event;
				if(e.stopPropagation) {
					e.stopPropagation();
				} else {
					e.cancelBubble = true;
				}
				$(this).parents(".row_select_xl").hide();
			});
			//下拉框结束
			//全选与取消
			$("#chkAll").click(function() {
				$("[name=chkGuid]:checkbox").prop("checked", this.checked);
			});
			//当所有checkbox选中，全选选中
			$("[name=chkGuid]:checkbox").click(function() {
				var flag = true;
				$("[name=chkGuid]:checkbox").each(function() {
					if(!this.checked) {
						flag = false;
					}
				});
				$("#chkAll").prop("checked", flag);
			})

		})
	</script>
	<%--<!--树结构-->
	<script type="text/javascript">
		//树结构
		$("#tree").treeview();
		$("#tree1").treeview();
		//树结构结束
		<!--树结构结束-->
	</script>--%>
	<script>
		var $table = $('#boot_table'),
				$remove = $('#remove'),
				selections = [];
		function initTable() {
			$table.bootstrapTable({
				idField: "id",
				pagination: "true",
				sidePagination: 'server',
				url: "<c:url value='/personnel/allPersonnelInfo.json'/>",
				height: 620,
				/*queryParam:{deptId:s},*/
			columns: [
					{
						/*title: '<input type="checkbox" id="chkAll"/>',
						field: 'dbid',
						align: 'center',
						valign: 'middle',
						formatter: function (value, row, index) {
							var str = "<input type='checkbox' name='chkGuid' value=" + value + " />";
							return str;
						}
					},{*/
						title: '序号',
						field: 'Number',
						align: 'center',
						valign: 'middle',
						formatter: function (value, row, index) {
							var page = $table.bootstrapTable("getOptions");
							return ((page.pageNumber- 1 )* page.pageSize)+ index+1;
						}
					}, {
						title: '姓名',
						field: 'name',
						align: 'center',
						valign: 'middle'
					}, {
						field: 'policeNum',
						title: '警号',
						align: 'center',
						valign: 'middle'
					}, {
						field: 'dutyName',
						title: '职务',
						align: 'center',
						valign: 'middle',
						width:150,
					}, {
						field: 'dutyLevel',
						title: '职级',
						align: 'center',
						valign: 'middle',
					}, {
						field: 'tel_mobile',
						title: '联系电话',
						align: 'center',
						valign: 'middle',
					},{
						field: 'deptManager',
						title:'部门负责人',
						align: 'center',
						valign: 'middle',
						formatter: function (value, row, index) {
							switch(value)
							{
								case 0:
									return [
										'<a href="javascript:editDeptManager('+row.dbid+','+row.deptId+')">否',
										'</a>  '
									].join('');
								case 1:
									return [
										'<a href="javascript:editDeptManager('+row.dbid+','+row.deptId+')">是',
										'</a>  '
									].join('');
							}
						}
					},{
						field: 'activeFlag',
						title:'有效性',
						align: 'center',
						valign: 'middle',
						formatter: function (value, row, index) {
							switch(value)
							{
								case '0':
									return [
										'<a href="javascript:editActiveFlag('+row.dbid+')" id=yxx'+row.dbid+'>否',
										'</a>  '
									].join('');
								case '1':
									return [
										'<a href="javascript:editActiveFlag('+row.dbid+')" id=yxx'+row.dbid+'>是',
										'</a>  '
									].join('');
							}
						}
					},{
						field: 'joinCheck',
						title:'参与考核',
						align: 'center',
						valign: 'middle',
						formatter: function (value, row, index) {
							switch(value)
							{
								case 0:
									return [
										'<a href="javascript:editJoinCheck('+row.dbid+')" id=cykh'+row.dbid+'>否',
										'</a>  '
									].join('');
								case 1:
									return [
										'<a href="javascript:editJoinCheck('+row.dbid+')" id=cykh'+row.dbid+'>是',
										'</a>  '
									].join('');
							}
						}
					},{
						field: 'operate',
						title: '操作',
						align: 'center',
						valign: 'middle',
						formatter: function(value, row, index){
							return [
								'<a href="javascript:rybj('+row.dbid+')">编辑',
								'</a>  '/*,
								'<a href="javascript:rysc('+row.dbid+')" >删除',
								'</a>  '*/
							].join('');
						}
					}
				]
			});
		}
		/*function getHeight() {
			return $(window).height() - $('h1').outerHeight(true);
		}*/
		function rybj(dbid){
				var open =  layer.open({
					type: 2,                                    //0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）。
					shift: 1,//动画    0-6     css3动画
					closeBtn: 1,       //关闭按钮  0 不显示  style  1和2  标题为 false 2
					btn: ['确定', '取消'],
					shade: [0.8, '#393D49'],
					btn1: function(index, layero){
						var newpsw = $(layero).find("iframe")[0].contentWindow;
						newpsw.submitForm();

					},
					title:['人员编辑','background:#5f9ad1;color:#fff;text-align: left;font-size: 18px;'],
					area: ['500px', '400px'], //宽高
					content:"<c:url value='/personnel/findPersonnelInfo.html?dbid='/>"+dbid//iframe层-禁滚动条  $("#photosDemo").html()   'http://www.baidu.com/'
				});
		}
		function rysc(dbid){
			var open = layer.open({
				btn: ['确定', '取消'],
				btn1: function (index, layero) {
					$.ajax({
						type: "GET",
						url: "<c:url value="/personnel/delPersonInfo.json"/>",
						data: {dbid:dbid},
						dataType: "json",
						success: function(rs){
							if (rs.data.status == 1) {
								showMessage("操作成功！");
							} else {
								showMessage(rs.data.body);
							}
						},
						error: function(){
							showMessage("失败！");
						}
					});
				},
				title: '信息'
				,content:'确定删除吗？'
			});
		}
		function editDeptManager(dbid,deptId,obj){
			var open = layer.open({
				btn: ['确定', '取消'],
				btn1: function (index, layero) {
					$.ajax({
						type: "GET",
						url: "<c:url value="/personnel/editDeptManager.json"/>",
						data: {dbid:dbid,deptId:deptId},
						dataType: "json",
						success: function(rs){
							if (rs.data.status == 1) {
								showMessage("操作成功！");
								$("#boot_table").bootstrapTable('refresh');
							} else {
								showMessage(rs.data.body);
							}
						},
						error: function(){
							showMessage("失败！");
						}
					});
				},
				title: '信息'
				,content:'确定设置为部门负责人吗？'
			});
		}
		function editJoinCheck(dbid){
			var open = layer.open({
				btn: ['确定', '取消'],
				btn1: function (index, layero) {
					$.ajax({
						type: "GET",
						url: "<c:url value="/personnel/editJoinCheck.json"/>",
						data: {dbid:dbid},
						dataType: "json",
						success: function(rs){
							if (rs.data.status == 1) {
								showMessage("操作成功！");
								if($("#cykh"+dbid).text()=='是'){
									$("#cykh"+dbid).text('否');
								}else{
									$("#cykh"+dbid).text('是');
								}
							} else {
								showMessage(rs.data.body);
							}
						},
						error: function(){
							showMessage("失败！");
						}
					});
				},
				title: '信息'
				,content:'确定更改参与考核项吗？'
			});
		}
		function editActiveFlag(dbid){
			var open = layer.open({
				btn: ['确定', '取消'],
				btn1: function (index, layero) {
					$.ajax({
						type: "GET",
						url: "<c:url value="/personnel/editActiveFlag.json"/>",
						data: {dbid:dbid},
						dataType: "json",
						success: function(rs){
							if (rs.data.status == 1) {
								showMessage("操作成功！");
								if($("#yxx"+dbid).text()=='是'){
									$("#yxx"+dbid).text('否');
								}else{
									$("#yxx"+dbid).text('是');
								}
							} else {
								showMessage(rs.data.body);
							}
						},
						error: function(){
							showMessage("失败！");
						}
					});
				},
				title: '信息'
				,content:'确定更改有效性吗？'
			});
		}
		function showMessage(content) {
			layer.open({
				title: '信息'
				, content: content
			});
		}
	</script>
	</body>

</html>